﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebPartPages;

namespace MS.InformationManagement.WP.DocumentCenter.AdministrationWebparts.ContactsList
{
    public partial class ContactsListUserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);


            //SPList list = SPContext.Current.Web.Lists.TryGetList("Contactos Externos");

            //// Create a webpart 
            //ListViewWebPart wp = new ListViewWebPart();
            //wp.ZoneID = "Zone 1";   // Replace this ith the correct zone on your page. 
            //wp.ListName = list.ID.ToString("B").ToUpper();
            //wp.ViewGuid = list.DefaultView.ID.ToString("B").ToUpper();

            //// Get the web part collection 
            //SPLimitedWebPartManager coll = SPContext.Current.Web.GetLimitedWebPartManager("pages/roles.aspx", PersonalizationScope.Shared);

            //// Add the web part 
            //coll.AddWebPart(wp, "Zone 1", 0);

            ////Microsoft.SharePoint.WebPartPages.XsltListViewWebPart myListView = this.FindControl("wpListView") as Microsoft.SharePoint.WebPartPages.XsltListViewWebPart;
            ////myListView.Visible = true;
            //myListView.EnableViewState = true;
            //SPList list = SPContext.Current.Web.Lists["Contactos Externos"];
            //myListView.ListName = list.ID.ToString("B").ToUpperInvariant();
            //myListView.TitleUrl = list.DefaultViewUrl;
            //myListView.WebId = list.ParentWeb.ID;
            //myListView.ListId = (System.Guid)list.ID;
            //myListView.ShowToolbarWithRibbon = true;
            //myListView.ViewGuid = list.DefaultView.ID.ToString("B").ToUpperInvariant();
            ////myListView.
        }

    }
}
